import Vue from "vue";
//注意这里导入的是router模块而不是
import VueRouter from "vue-router";

//导入模板页面
import Main from '../views/Main'
import AllBody from "@/views/choose/AllBody";
import AdditionBody from "@/views/choose/AdditionBody";
import DivisionBody from "@/views/choose/DivisionBody";
import MultiplicationBody from "@/views/choose/MultiplicationBody";
import SubtractionBody from "@/views/choose/SubtractionBody";
import WrongSet from "../views/hread/WrongSet";
import Count from "../views/hread/Count";

Vue.use(VueRouter)

//写主路由配置
const routes = [
    {
        path:'/',
        name:'Main',
        component:Main,
        children:[
            {
                path: '/',
                name: 'AllBody',
                component:AllBody
            },
            {
                path: '/AdditionBody',
                name: 'AdditionBody',
                component:AdditionBody
            },
            {
                path: '/DivisionBody',
                name: 'DivisionBody',
                component:DivisionBody
            },
            {
                path: '/MultiplicationBody',
                name: 'MultiplicationBody',
                component:MultiplicationBody
            },
            {
                path: '/SubtractionBody',
                name: 'SubtractionBody',
                component:SubtractionBody
            },
            {
                path:'/wrongSet',
                name:'wrongSet',
                component: WrongSet
            },
            {
                path:'/Count',
                name:'Count',
                component: Count
            }
        ]
    }


]

// 创建一个路由，把上面写的routes配置丢进来
const router = new VueRouter({
    //mode: 'history', 导出有问题，注释掉
    base: process.env.BAse_URL,
    routes
})

//将路由暴露出去
export default router